package com.tjshop.android.model;

import org.json.JSONException;
import org.json.JSONObject;

public class Shop {
	private String shop_id;// "shop_id": "5",
	private String shop_name;// "shop_name": "歌天V秀氧吧KTV（颖昌大道店）",
	private String address;// "address": "许昌市魏都区颍昌大道886号（许昌万荣心脑血管病医院斜对面）",
	private String phone;// "phone": "0374-2524856",
	private String lat;// "lat": "34.026703",
	private String lng;// "lng": "113.828287",
	private String city_id;// "city_id": "13"

	public String getShop_id() {
		return shop_id;
	}

	public void setShop_id(String shop_id) {
		this.shop_id = shop_id;
	}

	public String getShop_name() {
		return shop_name;
	}

	public void setShop_name(String shop_name) {
		this.shop_name = shop_name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getLat() {
		return lat;
	}

	public void setLat(String lat) {
		this.lat = lat;
	}

	public String getLng() {
		return lng;
	}

	public void setLng(String lng) {
		this.lng = lng;
	}

	public String getCity_id() {
		return city_id;
	}

	public void setCity_id(String city_id) {
		this.city_id = city_id;
	}

	public void parse(JSONObject data) {
		setShop_id(getString(data, "shop_id"));// private String
												// shop_id;//"shop_id": "5",
		setShop_name(getString(data, "shop_name"));// private String
													// shop_name;//"shop_name":
													// "歌天V秀氧吧KTV（颖昌大道店）",
		setAddress(getString(data, "address"));// private String
												// address;//"address":
												// "许昌市魏都区颍昌大道886号（许昌万荣心脑血管病医院斜对面）",
		setPhone(getString(data, "phone"));// private String phone;//"phone":
											// "0374-2524856",
		setLat(getString(data, "lat"));// private String lat;//"lat":
										// "34.026703",
		setLng(getString(data, "lng"));// private String lng;//"lng":
										// "113.828287",
		setCity_id(getString(data, "city_id"));// private String
												// city_id;//"city_id": "13"
	}

	public int getInt(JSONObject obj, String id) {
		try {
			if (obj.has(id)) {
				return obj.getInt(id);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return 0;
	}

	public String getString(JSONObject data, String id) {
		try {
			if (data.has(id)) {
				return data.getString(id);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return null;
	}
}
